package com.otupia.acs.facade;

import com.cvlep.appbase.locator.Locator;
import com.otupia.acs.entity.UserInfo;
import com.otupia.acs.locator.LocatorRoutingImpl;
import com.otupia.acs.spring.api.Authenticator;
import com.otupia.acs.spring.api.UserManager;

public class UserServiceBean implements UserService
{
	private Locator locator = LocatorRoutingImpl.getInstance();

	private UserManager userManager = (UserManager) this.locator.getBean("userManager");
	private Authenticator authenticator = (Authenticator) this.locator.getBean("authenticator");
	
	public Locator getLocator()
	{
		return locator;
	}

	public void setLocator(Locator locator)
	{
		this.locator = locator;
		
		this.userManager = (UserManager) this.locator.getBean("userManager");
		this.authenticator = (Authenticator) this.locator.getBean("authenticator");
	}
	
	public void remove(long id)
	{
		userManager.removeUser(id);
	}

	public UserInfo login(UserInfo userInfo)
	{
		return authenticator.login(userInfo);
	}

	public void register(UserInfo userInfo)
	{
		userManager.register(userInfo);
	}

	public void update(UserInfo userInfo)
	{
		userManager.updateUser(userInfo);
	}

}
